import { _decorator, Component, EventTouch, Input, Label, Node } from 'cc';
import { EventManager } from '../manager/event';
import { GameConst } from '../config/game-param';
const { ccclass, property } = _decorator;

@ccclass('UIStart')
export class UIStart extends Component {
    @property(Label) record: Label
    
    static readonly prefabUrl: string
    static readonly bundleName: string



    onLoad() {
        this.node.on(Input.EventType.TOUCH_START, this.onTouchStart, this)
        this.record.string = GameConst.SELF_RECORD.toString()
    }

    onTouchStart(event: EventTouch) {
        EventManager.emit('on-touch-game-start')
        this.node.active = false
    }

    onDestroy() {
        this.node.off(Input.EventType.TOUCH_START, this.onTouchStart, this)
    }
}


